<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
  html { height: 100% }
  body { height: 100%; margin: 0px; padding: 0px }
  #map_canvas { height: 100% }
</style>
<script type="text/javascript"src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script src="http://google-maps-utility-library-v3.googlecode.com/svn/tags/markermanager/1.0/src/markermanager.js"></script>
<script language="JavaScript" type="text/javascript" src="dataset.js"></script>
<script type="text/javascript">

var TheMap;
var TheMarker;
 
function initialize() 
{
	var latlng = new google.maps.LatLng(48.8566140, 2.3522219); /*paris*/
	var myOptions = 
	{
		zoom: 3,
		center: latlng,
		mapTypeId: google.maps.MapTypeId.TERRAIN
    };
	
    TheMap = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
	//TheInfoWindow = new google.maps.InfoWindow(); 

	  /*google.maps.event.addListener(TheMap, 'dragend', function(event) 
	  {
	  alert(event.latLng);
		placeMarker(event.latLng);
	  });*/
  
	// Dans la fonction initialize()
	//google.maps.event.addListener(TheMap,'click',OnMapClick) ;
	// ...
	/*function OnMapClick(overlay,point) 
	{
	placeMarker(event.latLng);
		if (overlay.point) window.external.FromGM_MapClick(overlay.point.x,overlay.point.y) ;
	}*/
	
	/*var lat = window.external.LatFromCS();
	var lng = window.external.LngFromCS();
    var showMarker = window.external.ShowMarker();*/
	//window.external.FromCS_MapLoad(lat, lng);
	//alert(lat+" "+ lng);
	/*var location = new google.maps.LatLng(lat, lng);
	if(showMarker)
		placeMarker(location);*/
	TheMap.setCenter(latlng);
 }
 

function placeMarker(lat, lng) 
{
	var location = new google.maps.LatLng(lat, lng);
	TheMap.setCenter(location);
	if(null != TheMarker)
		TheMarker.setMap(null);
		
	TheMarker = new google.maps.Marker
	({
		position: location, 
		map: TheMap,
		draggable:true
	});
	
  
  google.maps.event.addListener(TheMarker, 'dragend', function() 
  {
	var location =  TheMarker.getPosition();
	window.external.FromGM_MarkerDropEnd(location.lat(),location.lng()) ;
  });
  
  google.maps.event.addListener(TheMap,'click',function()
  {
	var location =  TheMarker.getPosition();
	window.external.FromGM_MarkerDropEnd(location.lat(),location.lng()) ;
  }) ;
  
}

function hideMarker()
{
if(TheMarker != null)
 TheMarker.setMap(null);
}

</script>

</head>
	<body onload="initialize()">
	<div id="map_canvas" style="width:100%; height:100%"></div>
	<script language="JavaScript" type="text/javascript">
</script>
	</body>
</html>